﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ivan_snake
{
    class GameRender
    {
        public void RenderFood(Food f)
        {
            Console.SetCursorPosition(f.X, f.Y);
            Console.WriteLine(f.FoodType);
            Console.BackgroundColor = ConsoleColor.Black;
        }

        public void RenderSnake(Snake snake)
        {
           
           foreach (SnakePart sp in snake)
               RenderSnakePart(sp);

        }
        private void RenderSnakePart (SnakePart sp)
        {
            Console.SetCursorPosition(sp.X, sp.Y);
            Console.WriteLine(sp.Body);
            Console.BackgroundColor = ConsoleColor.Black;
        }
        public void RenderField(Field f)
        {
            for (int i = 0; i < f.X; i++)
            {
                Console.SetCursorPosition(0, i);
                Console.WriteLine(f.Point);
                Console.BackgroundColor = ConsoleColor.Black;
            }

            for (int i = 0; i < f.Y; i++)
            {
                Console.SetCursorPosition(i, 0);
                Console.WriteLine(f.Point);
                Console.BackgroundColor = ConsoleColor.Black;
            }
            for (int i = f.Y ; i >=0; i--)
            {
                Console.SetCursorPosition(f.Y , i);
                Console.WriteLine(f.Point);
                Console.BackgroundColor = ConsoleColor.Black;
            }
            for (int i = f.X; i >= 0; i--)
            {
                Console.SetCursorPosition(i, f.X );
                Console.WriteLine(f.Point);
                Console.BackgroundColor = ConsoleColor.Black;
            }

            Console.BackgroundColor = ConsoleColor.Black;
        }
    }
}
